package model

import (
	"gorm.io/gorm"
)

type Orders struct {
	gorm.Model
	UserId            int32   `gorm:"column:user_id;type:int;comment:用户Id;not null;" json:"user_id"`
	OrderNumber       string  `gorm:"column:order_number;type:varchar(255);comment:订单号;not null;" json:"order_number"`
	ProductsId        int32   `gorm:"column:products_id;type:int;comment:商品Id;not null;" json:"products_id"`
	ProductsName      string  `gorm:"column:products_name;type:varchar(255);comment:商品名称;not null;" json:"products_name"`
	PayPrice          float64 `gorm:"column:pay_price;type:decimal(10, 2);comment:支付价格;not null;" json:"pay_price"`
	TotalPrice        float64 `gorm:"column:total_price;type:decimal(10, 2);comment:总价;not null;" json:"total_price"`
	PreferentialPrice float64 `gorm:"column:preferential_price;type:decimal(10, 2);comment:优惠价;not null;" json:"preferential_price"`
	Num               int32   `gorm:"column:num;type:int;comment:购买数量;not null;" json:"num"`
	OrderStatus       int32   `gorm:"column:order_status;type:int;comment:订单状态:1-交易完成,2-交易成功,3-待付款,4-交易关闭(异常等);not null;default:3;" json:"order_status"`
}

func (*Orders) TableName() string {
	return "orders"
}
